﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using MiWebSite_Core;
using WLMCoreLibrary;
using System.Text;
using Newtonsoft.Json;

namespace MWS_Blog.Json
{
    

    public partial class Categorias : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            dbConnector ConexionDB = new dbConnector();
            StringBuilder lista = new StringBuilder();
            MiWebSiteBlogCategoriaCollection cats = new MiWebSiteBlogCategoriaCollection(ref ConexionDB);
            ConexionDB.CloseConnection();    
            List<Tag> categorias = new List<Tag>();
            foreach (MiWebSiteBlogCategoria item in cats.Elementos)
            {
                categorias.Add(new Tag(item.NombreCategoria,item.NombreCategoria));
            }
            Response.ContentType = "application/json";
            Response.Write(JsonConvert.SerializeObject(categorias));
            
        }
    }
}